Skip to content

[Special functions] Implement Bessel functions#2

Merged
shivasankarka merged 13 commits intomojomath:mainfrom
shivasankarka:special_funcs
Mar 4, 2026
Merged

[Special functions] Implement Bessel functions#2
shivasankarka merged 13 commits intomojomath:mainfrom
shivasankarka:special_funcs

Conversation

@shivasankarka
Copy link
Copy Markdown
Member

This PR adds support for the following functions,

  • Bessel function of first and second kind ($J_0$, $J_1$, $Y_0$, $Y_1$).
  • Bessel function of first kind for order n ($J_n$).
  • Modified Bessel functions of the first kind and their scaled forms ($i_0, i_1, i_0e, i_1e$)

@shivasankarka shivasankarka requested a review from forfudan March 4, 2026 15:36
@shivasankarka shivasankarka marked this pull request as draft March 4, 2026 15:36
@shivasankarka
Copy link
Copy Markdown
Member Author

shivasankarka commented Mar 4, 2026

@forfudan You'll have to merge #1 first and then this PR. So I will mark it as draft so that we don't accidentally merge it.

@shivasankarka shivasankarka marked this pull request as ready for review March 4, 2026 16:21
@forfudan
Copy link
Copy Markdown
Member

forfudan commented Mar 4, 2026

@forfudan You'll have to merge #1 first and then this PR. So I will mark it as draft so that we don't accidentally merge it.

I will do a rebase and then approve this. Please do not merge main branch to here. Otherwise it will be like numojo (accumulating commits)

Copy link
Copy Markdown
Member

@forfudan forfudan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivasankarka Thanks for this PR.

I made some adjustments and approved it.

  1. About using the SIMD with width. I understand that you want to work on some vectorized approach, but I think it might be a little bit pre-mature for at this stage. Currently we should focus on scalar calculation. The extension to vector should be based on NuMojo NDArray but not SIMD (which would also be the case of scipy which is based on numpy array). So I revert them to Float64 for now and let's do that in future with NuMojo. How do you think?
  2. About j1, you discuss the case of x > 10 but not x < -10, so I add abs to it.
  3. The i0e and 1ie in docstring example seem to be incorrect. I changed it.
  4. In test_bessel_scipy, you seem to calculate all values twice, so I just extract them to the top and calculate them once.
  5. In y0, abs(x) < 8.0 seems not needed, since you already treated x < 0.0 before, so I removed the abs().

@shivasankarka shivasankarka merged commit b564382 into mojomath:main Mar 4, 2026
1 check passed
forfudan added a commit that referenced this pull request Mar 5, 2026
This PR adds support for the following functions,
- Bessel function of first and second kind ($J_0$, $J_1$, $Y_0$, $Y_1$).
- Bessel function of first kind for order `n` ($J_n$).
- Modified Bessel functions of the first kind and their scaled forms ($i_0, i_1, i_0e, i_1e$)

---------

Co-authored-by: ShivaSankar <shivasankar.ka@gmail.com>
Co-authored-by: ZHU Yuhao <dr.yuhao.zhu@outlook.com>
@shivasankarka shivasankarka deleted the special_funcs branch March 5, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants